import DefaultPage from "@/pages/DefaultPage.vue";

const routes = [
    // path 地址定义
    //      path 地址定义规则是 参考 服务器路径地址规则的
    //          + 一级路由地址必须以 / 方式描述，表示该路径为vue路由的最顶层地址路径
    //          + 其它级别的地址可以使用 以/开头的绝对地址模式，或者不以/开头的相对地址模式
    //                  - 以/开头的绝对地址模式 => 子路由提供独立的导航地址，访问该地址时 类似于从服务器根目录中加载该组件
    //                  - 不以/开头的相对地址模式 => 子路由只提供自己的相对URL地址，访问该地址时，必须先访问父路由地址
    // component 该地址对应的组件
    // { path:"/",component:DefaultPage },
    { path:"/",redirect:"/default" },
    { 
        path:"/default",name:"default",component:DefaultPage,
        // 路由元信息对象
        meta:{
            hideHomeBtn:true,
        }
    },
    { path:"/error",component: () => import( /* webpackChunkName:"base" */ "@/pages/ErrorPage.vue" ) },
    { path:"/style",component: () => import( /* webpackChunkName:"base" */ "@/pages/StylePage.vue" ) },
    { path:"/build",component: () => import( /* webpackChunkName:"base" */ "@/pages/BuildPage.vue" ) },
    { path:"/compos1",component: () => import( /* webpackChunkName:"composition" */ "@/pages/CompositionPage.vue" ) },
    { path:"/compos2",component: () => import( /* webpackChunkName:"composition" */ "@/pages/CompositionPage2.vue" ) },
    { path:"/compos3",component:() => import( /* webpackChunkName:"composition" */ "@/pages/CompositionPage3.vue" ) },
    { path:"/cart",component: () => import( /* webpackChunkName:"composition" */ "@/pages/CompositionCart.vue" ) },
    { path:"/ajax",component: () => import( /* webpackChunkName:"ajax" */ "@/pages/AjaxPage.vue" ) },
    { 
        path:"/router",component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/RouterPage.vue" ),
        // 通过 children 属性完成子路由的定义
        // children:取值等同于 createRouter 配置选项的 routes 取值
        children:[
            { path:"",redirect:"/router/one" },
            { path:"one",component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/views/RouterChildOne.vue" ) },
            { path:"two",component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/views/RouterChildTwo.vue" ) },
            { path:":a(.*)*",component: () => import( /* webpackChunkName:"router" */ "@/pages/NotFound.vue" ) }
        ]
    },
    { path:"/config",component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/RouterConfig.vue" ) },
    { 
        path:"/params",
        component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/RouterParams.vue" ),
        children:[
            { path:"query",name:"query",component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/views/QueryRouter.vue" ) },
            // { path:"rest/:id/:name",name:"rest",component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/views/RestRouter.vue" ) },
            { path:"rest/:id?/:name?",name:"rest",component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/views/RestRouter.vue" ) },
            { path:":a(.*)*",component: () => import( /* webpackChunkName:"router" */ "@/pages/NotFound.vue" ) }
        ]
    },
    // 编程式导航
    { path:"/login1", name:"login1", component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/RouterNav.vue" ) },
    { path:"/success", name:"success", component: () => import( /* webpackChunkName:"router" */ "@/pages/RouterPages/RouterSuccess.vue" ) },
    // 编程式导航

    // 路由守卫
    { 
        path:"/guard", name:"guard", component: () => import( /* webpackChunkName:"guard" */ "@/pages/RouterPages/RouterGuard.vue" ),
        children:[
            { path:"gone",name:"gone",component: () => import( /* webpackChunkName:"guard" */ "@/pages/RouterPages/views/GuardChild.vue") }
        ]
    },
    // 路由守卫
    { path:"/vuex", name:"vuex", component: () => import( /* webpackChunkName:"vuex" */ "@/pages/VuexPage.vue" ) },

    { path:"/:a(.*)*",component: () => import( /* webpackChunkName:"404" */ "@/pages/NotFound.vue" ) }
]

export default routes;